/*
 * Copyright (C) 2008
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.sca4idea.actions;

import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.project.Project;
import com.googlecode.sca4idea.SCABundle;

import javax.swing.*;

/**
 * Dialog allowing the user to configure details of a composite being created.
 */
public class NewCompositeDialog extends DialogWrapper {
    private JTextField nameTextField;
    private JTextField namespaceTextField;
    private JCheckBox enableAutowiringCheckBox;
    private JPanel mainPanel;

    public NewCompositeDialog(Project project) {
        super(project, false);
        init();

        setTitle(SCABundle.message("new.composite.dialog.title"));
        namespaceTextField.setText("urn:composite:com.example");
        enableAutowiringCheckBox.setSelected(true);

        // Make the name text field initially focussed
        nameTextField.grabFocus();
    }

    protected JComponent createCenterPanel() {
        return mainPanel;
    }

    public String getCompositeName() {
        return nameTextField.getText();
    }

    public String getCompositeNamespace() {
        return namespaceTextField.getText();
    }

    public boolean getEnableAutowiring() {
        return enableAutowiringCheckBox.isSelected();
    }
}
